<?php
session_start();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>


    

 <?php require_once("connect/dbcon.php");

 $ten=$_POST['ten'];
 $username=$_POST['username'];
 $pass=$_POST['pass'];
 $pass2=$_POST['pass2'];
 $diachi=$_POST['diachi'];
 $dt=$_POST['dt'];
 $email=$_POST['email'];
 
 if($pass == $pass2)
	{
		$Query = "insert into khachhang(HoTen, UserName, Password, DiaChi, DienThoai,Email,PhanQuyen) 
		values('$ten','$username','$pass','$diachi','$dt','$email','0')";
		$Result = mysql_query($Query);
		if(mysql_affected_rows()>0){
				$_SESSION["user"]= $email;
				echo "<script language='javascript'> alert('Đăng ký thành công!');location.href='index.php';</script>";}
			
			else{
				echo "<script language='javascript'> alert('Lỗi thông tin!');location.href='dk.php';</script>";
				}}
				else {
					echo "<script language='javascript'> alert('vui lòng gõ chính xác lại password'); location.href='index.php?ACT=dk';</script>";
				}
		
 
?>
</body>
</html>